import { DialogPanel } from './../../ab_subgame001/scripts/ui/DialogPanel/DialogPanel';
import { Enum } from "cc";
import { PanelConfigInfo, PrefabNameToPanelKeyMap, UIConfig, makePrefabStrToPanelKeyMap } from "../../scripts/libs/ui/UIConfig";

export namespace lobby {

    export enum PanelKey {
        LoadingPanel,
        FrontTipPanel,
        LobbyPanel,
        SettingPanel,
        DialogPanel,

        Subgame001RootPanel,
        Subgame002RootPanel,
    }
    Enum(PanelKey);

    const subgamekey = 'lobby';
    const assetbundle = `ab_${subgamekey}`;

    export const UIConfigList = [
        [PanelKey.LoadingPanel, {
            assetbundle, assetPath: 'Prefabs/LoadingPanel/LoadingPanel',
            tier: 'tier3',
            destroy: false, // 随场景的如果下次还需要，那么不能删
            scene: true,
            name: 'LoadingPanel',
        }],
        [PanelKey.FrontTipPanel, {
            assetbundle, assetPath: 'Prefabs/FrontTipPanel/FrontTipPanel',
            tier: 'tier3',
            destroy: true,
        }],
        [PanelKey.LobbyPanel, {
            assetbundle, assetPath: 'Prefabs/LobbyPanel/LobbyPanel',
            tier: 'tier1',
            destroy: true,
        }],
        [PanelKey.SettingPanel, {
            assetbundle, assetPath: 'Prefabs/SettingPanel/SettingPanel',
            tier: 'tier2',
            destroy: true,
        }],
        [PanelKey.DialogPanel, {
            assetbundle, assetPath: 'Prefabs/DialogPanel/DialogPanel',
            tier: 'tier2',
            destroy: true,
        }],

        [PanelKey.Subgame001RootPanel, {
            assetbundle: 'ab_subgame001', assetPath: 'Prefabs/UIRoot',
            tier: 'game1',
            destroy: true,
        }],

        [PanelKey.Subgame002RootPanel, {
            assetbundle: 'ab_subgame002', assetPath: 'Prefabs/UIRoot',
            tier: 'game1',
            destroy: true,
        }],
    ];

    // export const UILobbyConfig = new Map<PanelKey, PanelConfigInfo>(UIConfigList as any);

    export function init() {
        UIConfig.set(subgamekey, new Map());
        UIConfigList.forEach(_ => {
            UIConfig.get(subgamekey).set(_[0] as any, _[1] as PanelConfigInfo);
        });
        makePrefabStrToPanelKeyMap(UIConfigList as any, PrefabNameToPanelKeyMap);
    }

    init();

}